import { Injectable } from '@angular/core';
import {TOKEN_PRIFIX} from "../../app.config";

const storageName =TOKEN_PRIFIX;


@Injectable()
export class Storage{

	//获取指定localStorage
	public get(key:string):any{
		key = storageName + key;
		return localStorage.getItem(key);
	}


	//设置新的localStorage
	public set(key:string,val:any):void{
		key = storageName + key;
		localStorage.setItem(key,val);
	}


	//移除指定localStorage
	public remove(key:string):void{
		key = storageName + key;
		localStorage.removeItem(key);
	}


	//清空所有localStorage
	public clear():void{
		localStorage.clear();
	}


}